package com.atguigu.day09.test.o1;

public class Animal {
    String name;

    public String getInfo() {
        return "名字:" + name;
    }
}

class Dog extends Animal {
    int age;

    @Override
    public String getInfo() {
        //调用父类的方法
        String info = super.getInfo();
        // return "名字:"+name+",年龄:"+age;
        return info + ",年龄:" + age;
    }
}

class Cat extends Animal {
    String color;
    @Override
    public String getInfo() {
        return super.getInfo() + ",花色:" + color;
    }
}